package cn.code.admin.web;

import cn.code.admin.security.SecUser;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by 汪玉东 on 2017/11/5.
 */
@RestController
public class UserLoginController {

    @RequestMapping(value = "/login")
    public Object login(@AuthenticationPrincipal SecUser loginedUser, @RequestParam(name = "logout", required = false) String logout) {
        if (logout != null) {
            return null;
        }
        if (loginedUser != null) {
            return loginedUser;
        }
        return "test";
    }
}
